﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LinkCard.AdminCP.Common;

namespace LinkCard.AdminCP.CRM
{
    public partial class customer_active : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Int64 nCustomerID = ConvertUtility.ToInt64(Request.QueryString["ID"]);

            if (nCustomerID > 0)
            {
                string sSQL = "update Customer set IsActive = (Select [IsActive] = CASE [IsActive] WHEN 0 THEN 1 ELSE 0 END from Customer where CustomerID =" + nCustomerID + ") where CustomerID =" + nCustomerID;
                DataHelper.ExecuteNonQuery(sSQL, true);
                Response.Redirect("/CRM/customers_all_published.aspx");
            }
        }
    }
}